// Copyright (c) 2012 chenwq. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Pause
var pause = false;

// Listen for any request
chrome.webRequest.onBeforeRequest.addListener(function(details) {
		var url = details.url;
		
		if(!pause) {
			var pat = (new RegExp('(.+/)(en-us)(/.+)').exec(details.url));
			if(pat)
			{
				url = pat[1] + 'zh-cn' + pat[3];
				details.redirectto = true;
			}
		}
		
		return { redirectUrl:  url};
	}, 
	{
		urls: ['http://msdn.microsoft.com/*'],
		type: ['main_frame']
	}, 
	['blocking']
);